﻿Imports System
Imports System.Runtime.Serialization
Imports System.Workflow.ComponentModel

Namespace System.Workflow.ComponentModel.Serialization
    Friend NotInheritable Class ActivityExecutorSurrogate
        Implements ISerializationSurrogate
        ' Methods
        Public Sub GetObjectData(ByVal obj As Object, ByVal info As SerializationInfo, ByVal context As StreamingContext)
            info.AddValue("executorType", obj.GetType)
            info.SetType(GetType(ActivityExecutorRef))
        End Sub

        Public Function SetObjectData(ByVal obj As Object, ByVal info As SerializationInfo, ByVal context As StreamingContext, ByVal selector As ISurrogateSelector) As Object
            Return Nothing
        End Function


        ' Nested Types
        <Serializable> _
        Private NotInheritable Class ActivityExecutorRef
            Implements IObjectReference
            ' Methods
            Private Function System.Runtime.Serialization.IObjectReference.GetRealObject(ByVal context As StreamingContext) As Object Implements IObjectReference.GetRealObject
                Return ActivityExecutors.GetActivityExecutorFromType(Me.executorType)
            End Function


            ' Fields
            Private executorType As Type
        End Class
    End Class
End Namespace

